package com.retail.lottery.colalottery.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Configuration
public class ColaHttpUrlConfig {

    @Value("${api-forward-targetUrl}")
    public String targetUrl;

    public String getForwardTargetUrl(String forwardPath) {
        return targetUrl.concat(forwardPath);
    }

    public String getProvinceCityAreaUrl() {
        return targetUrl + "/api/member-counter/mini/province_city_area/tree";
    }

    public String getOrderSyncUrl(String param) {
        return String.format(targetUrl + "/api/icoke-thirdorder/%s/third_order/third_api/push", param);
    }

    public String getAccessTokenUrl() {
        return targetUrl + "/api/platform-tenant/authentication/client";
    }

    public String getOrderNoticeUrl(String param) {
        return String.format(targetUrl + "/api/icoke-thirdorder/%s/third_order/third_api/push", param);
    }

    public String getSetupInfoUrl(String buCode, String setupId) {
        return String.format(targetUrl + "/api/icoke-lottery/%s/lottery/open/%s/detail", buCode, setupId);
    }

    public String queryLotteryTimesUrl(String buCode) {
        return String.format(targetUrl + "/api/icoke-lottery/%s/lottery/open/current/times", buCode);
    }

    public String  messageNoticeUrl(String buCode) {
    return String.format(
        targetUrl + "/api/icoke-subscribe/%s/subscribe/subscribeTemplate", buCode);
    }

    public String getTargetUrl() {
        return targetUrl;
    }

    public void setTargetUrl(String targetUrl) {
        this.targetUrl = targetUrl;
    }

}
